我正在尝试使用Django设置Python3.6环境。安装说明说我应该安装mysqlclient,以便能够连接到mySQL。我明白了:
dennis@django:~$ sudo -H pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.10.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-4jiw3hvk/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-4jiw3hvk/mysqlclient/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
mySQL安装正确。mysql\u配置文件中应该包含什么?当我尝试升级pip3时,我得到以下结果:
dennis@django:~$ sudo -H pip3 install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
在使用pip3安装mysqlClient后,我注意到该模块安装在python3.5目录中,而不是python3.6目录中,所以当我试图导入运行python3.6的MySQLdb模块时,没有找到它
dennis@django:~/python_db$ python
Python 3.6.0+ (default, Feb 4 2017, 11:11:46)
[GCC 5.4.1 20161202] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'MySQLdb'
>>>
然后我重新运行使用python 3.5和它被发现。如何使用pip3将模块安装到3.6目录中?
就我而言,通过执行以下操作解决了问题:
sudo aptitude install libmysqlclient-dev
在我使用Python3.x时,以下内容也是必要的:
sudo aptitude install python3-dev
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
如果您正在使用Mac OS,请尝试以下操作:
brew安装mysql
如果你正在使用Ubuntu14/16,试试这个:
sudo-apt安装libmysqlclient-dev
还有一点:
pip3可以用sudo pip3安装-U pip
更新
我一直在努力尝试,但我无法克服这个错误。我有Ruby版本1.8.7和Gem版本2.1.11,我试图安装open project,但我总是遇到这个错误 安装json(1.8.1)gem::installer::extensionbuilderror:错误:未能构建gem本机扩展。 迈克 安装json(1.8.1)时出错,Bundler无法继续。在绑定之前,请确保成功。==>出错:(==>安装中止。
我在Mac上运行“pip3安装psycopg2”时遇到了这个错误。 我想第一次安装psycopg2。 我尝试了pip,从GitHub安装。然而,这两次都失败了。 有人能帮帮我吗?我真的很感激!
无法获取URLhttps://pypi.python.org/simple/jupyter/:确认ssl证书时出现问题:[ssl:certificate\u VERIFY\u FAILED]certificate VERIFY FAILED(\u ssl.c:748)-跳过 我使用的是Windows 7机器,Python 3.6版本和pip版本是9.0.1。
因此,即使成功地安装了pysqlcipher3,它也没有成功。 根据我的研究,这似乎是Windows用户试图安装Sqlcipher的常见问题。 尝试#1 首先,我尝试从github下载pysqlcipher3,并通过cmd手动构建和安装它(使用和)。 在执行Python3setup.py构建时,我有一些错误(缺少几个需求,没有OPENSSL_CONF环境变量等)。),但我修复了其中的大部分。 但是
我试图在Windows上安装Antlr 4.4,目的是使用pyfuzzy,这是一个模糊逻辑的Python库,它依赖于Antlr的Python运行时来运行。我曾尝试(天真地)在不安装Antlr的情况下获得Python (2.7)的Antlr运行时,当然这并不成功。 因此,我尝试按照Windows的说明安装Antlr,但每次运行时都会出现错误: antlr .jar文件位于 C:\JavaLib 中,
PS:我是nodejs和mongodb的初学者。事实上,这是我与nodejs和mongodb的第一天,我正在关注tutsplus的基本视频系列 我得到错误,而安装mongoDB模块...说明:Mac OX Lion,Xcode最新安装,MongoDB shell版本:2.4.3(通过自制安装),npm-v1.2.15,节点-v0.10.2 kerberos@0.0.2安装/Users/mohit/