我想在Python中创建一套相互关联的包.我希望他们都在同一个包下,但可以作为单独的组件安装.
因此,例如,安装基础软件包将提供mypackage但是在mypackage.subpackage我单独安装之前不会有任何内容.
是否可以使用distutils和pip?
我一直在尝试在运行Lion的mac上设置ipython 3(运行2.7正常),但似乎无法摆脱以下错误:
192:~ mlauria$ /Library/Frameworks/Python.framework/Versions/3.2/bin/ipython3
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages\
/IPython/utils/rlineimpl.py:96: RuntimeWarning: Leopard libedit detected - \
readline will not be well behaved including some crashes on tab completion, and \
incorrect history navigation. It is highly recommended that you install readline,\
which is easy_installable with: 'easy_install readline'
RuntimeWarning)
Python 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59)
Run Code Online (Sandbox Code Playgroud)
easy_install readline在ipython 2.7上正确地解决了这个问题,但是这并没有修复3.2.
我正在尝试使用PIP安装程序安装PIL,我得到了这个:
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.7-intel-2.7/_imaging.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
任何线索可能是什么问题?
我有Mac OS X Lion和LLVM安装在XCODE Developer工具中......有什么不对?
我一直试图解决这个问题超过2天,筛选互联网和教程,但我还没有解决我的问题.我是一个真正的新手,还不知道我在做什么..
我使用的软件:Mac OS X 10.6 Python v3.2.2交互式解释器(IDLE)
问题:IDLE的默认目录是/ Users/ME/Documents /.具有扩展名.py的文件只能在此目录中打开.但是,我创建了一个文件夹,我想保存所有与此软件有关的.py文件等.目前,IDLE无法从我选择的目录中加载.py文件.
我首先做的是我添加到IDLE:import sys.sys.path.append('Users/Mydir /')sys.path
但是,在2010年的现有线程中,我读取sys.path仅用于解释器,如果我要更改它,我需要修改PYTHONPATH环境变量:
PYTHONPATH ="/ Me/Documents/mydir:$ PYTHONPATH"导出PYTHONPATH
但是,我很困惑如何使用它并且无法找到以下问题的答案:1)安装程序时,我的计算机上已经存在PYTHONPATH(.py?)?如果是,那它在哪里?我找不到任何地方.如果不是,我需要创建一个.但是内容应该在哪里以及应该是什么,以便IDLE可以从非默认目录加载文件?它应该只包含粗体字吗?
我希望我能清楚地解决问题.
干杯
我只是尝试使用AppleScript计算字符串的MD5:
set hash_string to do shell script "echo -n hi | md5"
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我实际上用"hi"替换了传递给shell的字符串作为测试.AppleScript报告:
tell current application
do shell script "echo -n hi | md5"
--> "5ea3a74c5a5c60abd09da8c5f85fa0a5"
end tell
Run Code Online (Sandbox Code Playgroud)
直接在终端中运行相同的命令会导致:
% echo -n hi | md5
49f68a5c8493ec2c0bf489821c21fc3b
Run Code Online (Sandbox Code Playgroud)
虽然命令是相同的,但计算的散列是不同的.显然,在AppleScript中传递了其他字符,但我似乎无法弄清楚它们是什么.我感谢任何指导.
我在 mac os x 上安装了 python 的 mysqldb,但它给了我以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dynamic module does not define init function (init_mysql)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我在64bit雪豹上安装了mysql-python,在python IDE下它很好,但在django中输入失败了.有人遇到过类似的问题吗?
File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured:
Error loading MySQLdb module: dlopen(/Users/szanlin/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so,
2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/szanlin/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
Reason: image not found
Run Code Online (Sandbox Code Playgroud) python ×5
django ×2
pip ×2
applescript ×1
command ×1
distutils ×1
easy-install ×1
ipython ×1
llvm ×1
macos ×1
md5 ×1
mysql-python ×1
python-2.7 ×1
python-3.x ×1
python-idle ×1
pythonpath ×1
readline ×1
shell ×1